//==========================================================================
// Copyright (c) 2000-2006,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#if !defined(__CAMPLUS_H_)
#define __CAMPLUS_H_

#define DIGITALZOOM_MAX     4

#define YCBCR_422_BYTES     2

typedef enum {
    CamDrv_Mod_Photo,
    CamDrv_Mod_Video,
    CamDrv_Mod_Preview
} CamDrv_Module;

typedef struct {
    BYTE *pY;
    BYTE *pCb;
    BYTE *pCr;
} YCbCrBufferInfo;

#include <camera.h>
#include "nt/framecapture.h"
#include "RGB2YCbCrConverter.h"
#include "framedisplay.h"
#include "videorecorder.h"
#include "photosnapper.h"

class CameraDriver
{
public:
    FrameDisplay       m_Shower;

    RGB2YCbCrConverter m_Converter;

public:
    PhotoSnapper      *m_PhotoSnapper;

    VideoRecorder     *m_pVideoRecorder;

private:
    BOOL  InitFrameDataInfo();

public:
    ECode CamDrv_Initialize();

    void  CamDrv_Quit();

    ECode CamDrv_GetSnapFrames(Camera_Photo *pPhoto);

    ECode CamDrv_BeginPreview(RECT *pRC);

    void  CamDrv_DoPreview(void *pFrameBuffer);

    ECode CamDrv_StopPreview();

    void  CamDrv_ReleaseFrames();

    ECode CamDrv_SetAppFormat(unsigned int nID, int wParam, int lParam);

    ECode CamDrv_GetAppFormat(unsigned int nID, int *pwParam, int *plParam);

    ECode CamDrv_SetCamMode(int iMode);

    ECode CamDrv_BeginVideoRecord(IEvent ** ppOutEvent);

    ECode CamDrv_StopVideoRecord();

    ECode CamDrv_GetVideoFrame(Camera_ImageFrame* pFrame);

};

EXTERN CameraDriver g_CameraDriver;

#endif //__CAMPLUS_H_
